<!--
 * @Description: 
 * @Version: 2.0
 * @Autor: 刘世琪
 * @Date: 2021-03-09 13:25:07
 * @LastEditors: Seven
 * @LastEditTime: 2021-03-15 11:55:03
-->
<template>
 <div>
    <div>
        <a-table  bordered :columns="columns" :data-source="user_list" :rowKey="(record,index)=>{return index}">
            <span slot="id" style="color: #ff6b81"><a-icon type="smile-o" /> ID</span>
            <span slot="username" style="color: #ff6b81"><a-icon type="smile-o" /> 用户名</span>
            <span slot="phone" style="color: #ff6b81"><a-icon type="smile-o" /> 手机号</span>
            <span slot="email" style="color: #ff6b81"><a-icon type="smile-o" /> 邮箱</span>
            <span slot="roles" style="color: #ff6b81"><a-icon type="smile-o" /> 等级</span>
            <span slot="money" style="color: #ff6b81"><a-icon type="smile-o" /> 余额</span>
        </a-table>
    </div>
  </div>
</template>

<script>
import axios from 'axios'
const columns = [
    {dataIndex: 'id', key: 'id', slots: { title: 'id' }},
    {dataIndex: 'username', key: 'username', slots: { title: 'username' }},
    // {dataIndex: 'phone', key: 'phone', slots: { title: 'phone' }},
    {dataIndex: 'email', key: 'email', slots: { title: 'email' }},
    {dataIndex: 'roles[0].title', key: 'roles', slots: { title: 'roles' }},
    // {dataIndex: 'money', key: 'money', slots: { title: 'money' }},
];
export default {
    
    data() {
        return {
            id: "",
            username: "",
            // phone:"",
            email:"",
            roles:'',
            money:'',
            user_list:[],
            columns,
            bser_url:'http://127.0.0.1:8000/',
            uid: localStorage.uid,
            
        }
    },
    methods: {
        onSearch(){
            axios({
                url: this.bser_url + 'Userg/?uid=' + this.uid,
            }).then(resp =>{
                console.log(resp.data)
                this.user_list = resp.data.data
            })
        }
    },
    created() {
        this.onSearch()

    }
}
</script>

<style scoped>

</style>
